<template>
  <div>
    <h1>Login页面</h1>
    <el-button @click="handleLogin">模拟登陆</el-button>
    <el-button @click="handleLogout">模拟登出</el-button>
  </div>
</template>

<script>
import { mapActions } from 'vuex';

export default {
  name: 'SystemLogin',
  components: {},
  data() {
    return {};
  },
  methods: {
    ...mapActions('user', ['login', 'logout']),
    handleLogin() {
      this.login({
        username: 'admin',
        password: 'admin',
      }).then(() => {
        console.log('登陆成功');
      });
    },
    handleLogout() {
      this.logout();
      console.log('退出登陆');
      this.$router.push('/login');
    },
  },
};
</script>

<style lang="scss" scoped></style>
